public class Tst {
    public static void main(String[] args) throws Exception {
        //扫描html标签里的“”
        StringBuilder all=new StringBuilder("<h1 style=\"mx\">闵续</h1><%=\"aaa\"%>");
        int tag=0;
        for(int i=all.length()-1;i>0;i--)
        {
            if(all.charAt(i)=='>'&&all.charAt(i-1)=='%')
                tag=1;
            if(all.charAt(i)=='%'&&all.charAt(i-1)=='<')
                tag=0;
            if(tag==1)
                continue;
            if(all.charAt(i)=='\"')
            {
                all.replace(i,i+1,"\\\"");
            }
        }
        System.out.println(all);
    }
}
